import random
import math
import string

domain = ['sina', 'baidu', 'google', 'aliyun', 'sohu', 'microsoft', 'h123', '360', 'Facebook' ];
prefix = ['www', 'view', 'top', 'first', 'mail', 'pan', 'site', 'manage', 'rss', 'bbs', 'store'];
suffix = ['com', 'cn', 'com.cn', 'top', 'io', 'lu', 'tw'];

domain_len = len(domain);
prefix_len = len(prefix);
suffix_len = len(suffix);

def gen_domain():
    t = random.choice(string.ascii_letters) 
    d = domain[math.trunc(random.random()*domain_len)]
    p = prefix[math.trunc(random.random()*prefix_len)]
    s = suffix[math.trunc(random.random()*suffix_len)]
    return t+'.'+p+'.'+d+'.'+s

def gen_timestamp():
    return '2022-03-23 20:29:11'

def gen_ip():
    return '192.168.1.1'

def gen_log():
    return gen_ip() + '\t' + gen_timestamp() + '\t' + gen_domain() + '\t' + gen_ip() + '\r\n'

file = open('sample.log', 'w')
i = 0 
while i<100000*350:
    i+=1
    file.write(gen_log())
